import {billListData} from '@/component/DailyBill/billListData'
// import { useEffect } from 'react'
const Icon = (props) => {
  const type = props.type?props.type:'drinks'
  const IconBillType = Object.keys(billListData).reduce((pre,key)=>{
    billListData[key].forEach(item=>{
      item.list.forEach(bill => {
         const image = `https://yjy-teach-oss.oss-cn-beijing.aliyuncs.com/reactbase/ka/${bill.type}.svg`
        pre[bill.type]=image
      })
    })
    return pre
  },{})
  
  // useEffect(()=>{
  //   console.log('IconBillType',IconBillType);
  // })
  return (
    <img
      src={IconBillType[type] ||`https://yjy-teach-oss.oss-cn-beijing.aliyuncs.com/reactbase/ka/${props.type}.svg` }
      alt="icon"
      style={{
        width: 20,
        height: 20,
      }}
      />
  )
}

export default Icon